﻿using System;
using System.Windows.Forms;
using Loki.UI.Win;
using Luna.Model;

namespace Luna.UI.Win
{
    public static class Program
    {
        private const string DATA_CONFIG = "assembly://Luna.Data/Luna.Data/data.config";
        private const string MODEL_CONFIG = "assembly://Luna.Model/Luna.Model/model.config";
        private const string UI_CONFIG = "assembly://Luna.Core/Luna.UI/viewmodel.config";
        private const string TEMPLATES_CONFIG = "file://Config/ui.config";

        private const string SKIN = "Dark Side";

        /// <summary>
        /// Point d'entrée principal de l'application.
        /// </summary>
        [STAThread]
        public static void Main()
        {
            _AppBootstapper = new LunaWinBootStrapper(
                DATA_CONFIG,
                MODEL_CONFIG,
                UI_CONFIG,
                TEMPLATES_CONFIG);
            DevExpress.UserSkins.BonusSkins.Register();
            DevExpress.Skins.SkinManager.EnableFormSkins();
            DevExpress.LookAndFeel.UserLookAndFeel.Default.SkinName = SKIN;

            Application.ApplicationExit += Application_ApplicationExit;

            WinFormBootStrapper<LunaModel, MainViewModel>.Run(_AppBootstapper);
        }

        private static LunaWinBootStrapper _AppBootstapper;

        private static void Application_ApplicationExit(object P_Sender, EventArgs e)
        {
            if (_AppBootstapper != null)
            {
                _AppBootstapper.Dispose();
            }
        }
    }
}
